/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author HoangHai
 */
@Entity
@Table(name = "Result")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Result.findBySeID", query = "SELECT DISTINCT r FROM Result r WHERE r.seID.seID = :seID"),
    @NamedQuery(name = "Result.findByClassID", query = "SELECT r FROM Result r WHERE r.classID.classID = :classID"),
    @NamedQuery(name = "Result.findAll", query = "SELECT r FROM Result r"),
    @NamedQuery(name = "Result.findByReID", query = "SELECT r FROM Result r WHERE r.reID = :reID")})
public class Result implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Basic(optional = false)
    //@NotNull
    @Column(name = "ReID")
    private Integer reID;
    @JoinColumn(name = "SubID", referencedColumnName = "SubID")
    @ManyToOne
    private Subject subID;
    @JoinColumn(name = "SeID", referencedColumnName = "SeID")
    @ManyToOne
    private Semester seID;
    @JoinColumn(name = "ClassID", referencedColumnName = "ClassID")
    @ManyToOne
    private Classes classID;

    public Result() {
    }

    public Result(Integer reID) {
        this.reID = reID;
    }

    public Integer getReID() {
        return reID;
    }

    public void setReID(Integer reID) {
        this.reID = reID;
    }

    public Subject getSubID() {
        return subID;
    }

    public void setSubID(Subject subID) {
        this.subID = subID;
    }

    public Semester getSeID() {
        return seID;
    }

    public void setSeID(Semester seID) {
        this.seID = seID;
    }

    public Classes getClassID() {
        return classID;
    }

    public void setClassID(Classes classID) {
        this.classID = classID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reID != null ? reID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Result)) {
            return false;
        }
        Result other = (Result) object;
        if ((this.reID == null && other.reID != null) || (this.reID != null && !this.reID.equals(other.reID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Result[ reID=" + reID + " ]";
    }
    
}
